package com.AAL.DAO;

import org.hibernate.classic.Session;

import com.AAL.DAO.Interface.IAccountInformationDAO;
import com.AAL.Model.AccountInformation;
import com.AAL.Utils.HibernateUtil;

public class AccountInformationDAO implements IAccountInformationDAO{

	@Override
	public AccountInformation saveAndUpdateAccountInformation(
			AccountInformation accountInformation) {
		Session session = HibernateUtil.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		try {
			session.saveOrUpdate(accountInformation);
		} catch (Exception e) {
			System.out.println("E:"+ e.getMessage());
			return null;
		}
		session.getTransaction().commit();
		return accountInformation;
	}

}
